import { Login } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import { obj2fd } from "@/utils/index";
import http from "@/api";
// 查询列表
export const ftpCfgGet = () => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/ftpCfgGet`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 新增
export const ftpCfgSet = (params: object) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/ftpCfgSet`, params, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 恢复
export const cfgBackupRecovery = (params: object) => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgBackupRecovery`, params, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 备份
export const cfgBackup = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgBackup`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 导入
export const cfgBackupUpload = (params) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgBackupUpload`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 下载
export const cfgBackupDownload = (params: object) => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgBackupDownload`, params, { loading: true , responseType: "blob" }); // 正常 post json 请求  ==>  application/json
};
// 删除
export const cfgBackupDel = (params: object) => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgBackupDel`, params, { loading: true}); // 正常 post json 请求  ==>  application/json
};

// 查询列表
export const getDataByPage = (params: object) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgBackupList`, params, { loading: false }); // 正常 post json 请求  ==>  application/json
};
